/**
 * @param {string} s
 * @return {boolean}
 */
var isValid = function (s) {
  if (!s || !s.length) return false
  const stack = []
  const map = {
    '(': ')',
    '[': ']',
    '{': '}',
  }
  for (const char of s) {
    if (char in map) {
      stack.push(char)
    } else {
      if (map[stack.pop()] !== char) return false
    }
  }
  return stack.length === 0
}
const s = "()[]{}"
const result = isValid(s)
console.log("🚀 ~ result:", result)
